package _15_generics._15_10.exercise;

import _15_generics._15_10._02_Holder;

import java.util.ArrayList;
import java.util.List;

/**
 * Create a generic method that takes as an
 * argument a _02_Holder<List<?>>. Determine what
 * methods you can and can't call for the Holder
 * and for the List. Repeat for an argument of
 * List<_02_Holder<?>>
 */
public class E29_WildcardTest {
    static void f1(_02_Holder<List<?>> holder){
        List<?> list = holder.get();
        System.out.println(holder.equals(list));
//        list.add(1); //error
        Object o = list.get(0);
        holder.set(new ArrayList<Float>());
    }

    static void f2(List<_02_Holder<?>> list){
        _02_Holder<?> holder = list.get(0);
        list.add(new _02_Holder<Double>(1.0));
    }

}
